package com.example.jett.mvvm_20180612_01;

import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;

import com.example.jett.mvvm_20180612_01.databinding.ActivityMainBinding;

public class MainActivity extends AppCompatActivity {

    User user=null;
    Handler handler=new Handler();
    Person person = null;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_main);
        ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
        user=new User("jett","123","https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1528809078&di=0cbe7aaa1bfeb63aa4203e4d4a690c63&src=http://img1.3lian.com/2015/w13/54/d/26.jpg");
        binding.setUser(user);
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                user.setName("lance");
                user.setPassword("******");
            }
        }, 3000);

        person = new Person("Louis",27);
        binding.setPerson(person);

    }
}






